import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class JdbcDemo04 {
    public static void main(String[] args) throws SQLException {
        Statement statement = JDBCUtil.getStatement();
//        String sql = "update student set name = '张老三' ";
//        int count = statement.executeUpdate(sql);
//        System.out.println(count);

//        String sql = "insert into student values(908,'张老四','女','1999','数学系','北京市'),(909,'张老五','女','1999','数学系','北京市')";
//        int count = statement.executeUpdate(sql);
//        System.out.println(count);


//        String sql = "delete from student where id = 909";
//        int count = statement.executeUpdate(sql);
//        System.out.println(count);


        String sql = "select * from student where name like '%三%'";

        System.out.println(sql);
        ResultSet resultSet = statement.executeQuery(sql);
        while (resultSet.next()) {
            System.out.println(resultSet.getString(2));
        }
        JDBCUtil.close(resultSet);
    }
}
